package com.huterox.linuxrember.utils;

import android.view.View;

import com.huterox.linuxrember.Dao.ReviewDBEngine;


/**
 *
 * 这个工具类是和内置的Linux命令手册数据库深度绑定的
 * 1. 根据当前需要复习的成都得到需要复习的指令的id
 * 2. 将对应指令放在一个数组当中，和1.相互使用
 *
 * */


public class AssignNeedReview {


    public static int size(int m) {
        if (m == 1 || m == 14 || (m >= 16 && m <= 19)) {
            return 16;
        }
        if (m == 2 || m == 3 || m == 13 || m == 15) {

            return 24;
        }
        if (m >= 4 && m <= 7) {
            return 32;
        }
        if (m >= 8 && m <= 12) {

            return 40;
        }
        if (m >= 20 && m <= 38) {

            return 8;
        }
        return m;
    }


    public static void Assign(View view, String NeedReviewComm[], int m) {

        ReviewDBEngine reviewDBEngine = ReviewDBEngine.getInstance(view.getContext());
        reviewDBEngine.open();
        int i;
        int count;

        if (m > 41) {

        } else {
            switch (m) {

                case 1://list1 *list1

                    count = 1;

                    for (i = 0; i < 8; i++)//学习list1
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 1;//计数器重置为1

                    for (i = 8; i < 16; i++)//复习list1
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }
                    break;
                case 2://list2 *list1→2
                    count = 9;
                    for (i = 0; i < 8; i++)//学习list2
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 1;//计数器重置为1

                    for (i = 8; i < 24; i++)//复习list1、2
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;


                case 3://list3 *list2、3

                    count = 17;

                    for (i = 0; i < 8; i++)//学习list3
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 9;

                    for (i = 8; i < 24; i++)//复习list2、3
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 4://list4 *list1、3、4

                    count = 25;

                    for (i = 0; i < 8; i++)//学习list4
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 1;//计数器重置为1

                    for (i = 8; i < 16; i++)//复习list1
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 17;

                    for (i = 16; i < 32; i++)//复习list3、4
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 5://list5 *list2、4、5

                    count = 33;

                    for (i = 0; i < 8; i++)//学习list5
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 9;

                    for (i = 8; i < 16; i++)//复习list2
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 25;

                    for (i = 16; i < 32; i++)//复习list4、5
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 6://list6 *list3、5、6

                    count = 41;

                    for (i = 0; i < 8; i++)//学习list6
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 17;

                    for (i = 8; i < 16; i++)//复习list3
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 33;

                    for (i = 16; i < 32; i++)//复习list5、6
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;


                case 7:// list7 *lis4、6、7

                    count = 49;

                    for (i = 0; i < 8; i++)//学习list7
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 25;

                    for (i = 8; i < 16; i++)//复习list4
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 41;

                    for (i = 16; i < 32; i++)//复习list6、7
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;


                case 8://list8 *list1、5、7、8

                    count = 57;

                    for (i = 0; i < 8; i++)//学习list8
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 1;

                    for (i = 8; i < 16; i++)//复习list1
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 33;

                    for (i = 16; i < 24; i++)//复习list5
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 49;

                    for (i = 24; i < 40; i++)//复习list7、8
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;


                case 9:// list9 *list2、6、8、9

                    count = 65;

                    for (i = 0; i < 8; i++)//学习list9
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 9;

                    for (i = 8; i < 16; i++)//复习list2
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 41;

                    for (i = 16; i < 24; i++)//复习list6
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 57;

                    for (i = 24; i < 40; i++)//复习list8、9
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }
                    break;


                case 10://list10 *list3、7、9、10

                    count = 73;

                    for (i = 0; i < 8; i++)//学习list10
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 17;

                    for (i = 8; i < 16; i++)//复习list3
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 49;

                    for (i = 16; i < 24; i++)//复习list7
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 65;

                    for (i = 24; i < 40; i++)//复习list9、10
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 11://list11 *list4、8、10、11

                    count = 81;

                    for (i = 0; i < 8; i++)//学习list11
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 25;

                    for (i = 8; i < 16; i++)//复习list4
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 57;

                    for (i = 16; i < 24; i++)//复习list8
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 73;

                    for (i = 24; i < 40; i++)//复习list10、11
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 12://list12 *list5、9、11、12

                    count = 89;

                    for (i = 0; i < 8; i++)//学习list12
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 33;

                    for (i = 8; i < 16; i++)//复习list5
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 65;

                    for (i = 16; i < 24; i++)//复习list9
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 81;

                    for (i = 24; i < 40; i++)//复习list11、12
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;

                case 13://*list6、10、12

                    count = 41;

                    for (i = 0; i < 8; i++)//复习list6
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 73;

                    for (i = 8; i < 16; i++)//复习list10
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 89;

                    for (i = 16; i < 24; i++)//复习list12
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 14://*list7、11

                    count = 49;

                    for (i = 0; i < 8; i++)//复习list7
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 81;

                    for (i = 8; i < 16; i++)//复习list11
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;

                case 15://*list1、8、12

                    count = 1;

                    for (i = 0; i < 8; i++)//复习list1
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 57;

                    for (i = 8; i < 16; i++)//复习list8
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 89;

                    for (i = 16; i < 24; i++)//复习list12
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;

                case 16:// *list2、9

                    count = 9;

                    for (i = 0; i < 8; i++)//复习list2
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 65;

                    for (i = 8; i < 16; i++)//复习list9
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }


                    break;


                case 17://*list3、10

                    count = 17;

                    for (i = 0; i < 8; i++)//复习list3
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 73;

                    for (i = 8; i < 16; i++)//复习list10
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }
                    break;


                case 18://*list4、11

                    count = 25;

                    for (i = 0; i < 8; i++)//复习list4
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 81;

                    for (i = 8; i < 16; i++)//复习list11
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 19://*list5、12

                    count = 33;

                    for (i = 0; i < 8; i++)//复习list5
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    count = 89;

                    for (i = 8; i < 16; i++)//复习list12
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 20:// *list6

                case 32:

                    count = 41;

                    for (i = 0; i < 8; i++)//复习list6
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 21://*list7

                case 33:
                    count = 49;
                    for (i = 0; i < 8; i++)//复习list7
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;
                    }

                    break;
                case 22://*list8
                case 34:
                    count = 57;

                    for (i = 0; i < 8; i++)//复习list8
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 23://*list9

                case 35:

                    count = 65;

                    for (i = 0; i < 8; i++)//复习list9
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 24:// *list10

                case 36:

                    count = 73;

                    for (i = 0; i < 8; i++)//复习list10
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;


                case 25://*list11

                case 37:

                    count = 81;

                    for (i = 0; i < 8; i++)//复习list11
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 26://*list12

                case 38:

                    count = 89;

                    for (i = 0; i < 8; i++)//复习list12
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 27://*list1

                    count = 1;

                    for (i = 0; i < 8; i++)//学习list1
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }
                    break;

                case 28://*list2

                    count = 9;

                    for (i = 0; i < 8; i++)//学习list2
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }
                    break;

                case 29://*list3

                    count = 17;

                    for (i = 0; i < 8; i++)//学习list3
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 30://*list4

                    count = 25;

                    for (i = 0; i < 8; i++)//学习list4
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }

                    break;

                case 31://*list5

                    count = 33;

                    for (i = 0; i < 8; i++)//学习list5
                    {
                        reviewDBEngine.open();
                        NeedReviewComm[i] = reviewDBEngine.queryCommandByid(view, count);
                        count++;

                    }
                    break;
            }
        }
    }

}
